extension NumStrEx on int {
  String toIntString(int count) {
    var str = toString();
    return List.filled(count - str.length, '0').join('') + str;
  }
}

extension NumEx on num {
  String get progress {
    return '${(this * 100).toInt()}%';
  }

  String get fileSize {
    List<String> unitArr = ['B', 'K', 'M', 'G'];
    int index = 0;
    var value = this;
    while (value > 1024) {
      index++;
      value = value / 1024;
    }
    String size = index > 0 ? value.toStringAsFixed(2) : value.toString();
    return size + unitArr[index];
  }
}
